import React, { Component } from "react";
import { connect } from "react-redux";
import * as action from "../../../action";
import { bindActionCreators } from "redux";
import { CountDown } from "react-vant";
 class Index extends Component {
  checkbox(index){
    this.props.checked(index)
  }
  componentDidMount() {
    this.props.getList();
  }
  render() {
    let { list,str } = this.props;
    console.log(str);
    return (
      <div className="main">
        <div className="header">
          <h1>排列组合</h1> 
          <CountDown time={30 * 120 * 1 * 1000} />
        </div>
        {list && list.length > 0 ? (
          list.map((item, index) => {
            return (
              <div key={index} className="list_1">
                <span>{item.title}</span>
                {
                  item.testList.map((item, index) =>{
                    return <p key={index}><input type="checkbox" onClick={
                      (index) =>{
                        this.checkbox.bind(this, index)
                      }
                    }
                   
                    /><span>{item.name}</span></p>
                  })
                }
              </div>
            );
          })
        ) : (
          <div>暂无数据</div>
        )}


        <button>萨达</button>
      </div>
    );
  }
}
let mapDispatchToProps = (dispatch) => bindActionCreators(action, dispatch);
let mapStateToProps = ({ RoduxList }) => {
  return RoduxList
};

export default connect(mapStateToProps, mapDispatchToProps)(Index);

